<?PHP
	session_start();
	session_cache_expire(30);
?>
<!--
	viewWeek.php
	@author Max Palmer
	@version 3/26/08
-->
<html>
	<head>
		<title>
			Master Schedule - Family Room
		</title>
		<link rel="stylesheet" href="styles.css" type="text/css" />
		<link rel="stylesheet" href="masterschedule.css" type="text/css" />
	</head>
	<body>
		<div id="container">
			<?PHP include('header.php');?>
			<div id="content">
				<?PHP
				include('masterSchedulePeople.inc');
				if($_SESSION['access_level']<2) {
					die("<p>Only managers can view the master schedule.</p>");
				}
				echo ('<span class="viewweek">');
				include_once('database/dbSchedules.php');
					echo "<br><br>";
				show_fam_schedule("FamOne", "Family Room Master Schedule - Group One");
					echo "<br><br>";
				show_fam_schedule("FamTwo", "Family Room Master Schedule - Group Two");

				?>
				<?PHP include('footer.inc');?>
			</div>
		</div>
	</body>
</html>

<?php
	/**
	* gets a week object, and displays it as a scheudle
	*/
	function show_fam_schedule($group, $groupname) {
		$days = array("Mon","Tue","Wed","Thu","Fri");
		$famshifts = array("9-12"=>"10-1", "12-3"=>"1-4", "3-6"=>"4-7");

		echo ("<table id=\"calendar\" align=\"center\"><tr><td colspan=\"6\" align=\"center\" class=\"weekname\">".$groupname."</td></tr>
				<tr><td bgcolor=\"#7991B1\"></td><td class=\"dow\">&nbsp;Monday</td>
				<td class=\"dow\">&nbsp;Tuesday</td>
				<td class=\"dow\">&nbsp;Wednesday</td>
				<td class=\"dow\">&nbsp;Thursday</td>
				<td class=\"dow\">&nbsp;Friday</td></tr>");
	    foreach ($famshifts as $shift=>$shiftdisplay) {
		    echo ("<tr><td class=\"hour\">".$shiftdisplay. "</td>");
			foreach ($days as $day)
				echo do_shift($group, $day, $shift);
			echo ("</tr>" .
				"<tr><td class=\"hour\"></td></tr>" .
				"<tr><td class=\"hour\"></td></tr>");
			echo ("</tr>");
	    }
		echo ("</table>");
	}

?>